<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>优惠券</title>
    <link rel="stylesheet" href="../css/youhui.css">
    <!-- <link rel="stylesheet" href="../font/iconfont.css"> -->
    <!-- <script src="../js/js.cookie.js"></script> -->
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="../js/cookie.min.js"></script>
</head>

<body>
    <header>
        <div>
            <img src="../img/yu2.png" alt="" class=".fanhui">
            <h2>我的优惠券</h2>
            <span></span>
        </div>
    </header>
    <section class="youhui_section">
        <article style="font-size: 0.4rem;text-align:center">
        </article>
    </section>
</body>
<script>
    console.log(getCookie('couponsId'))
    if(getCookie('couponsId')){
        $.ajax({
            url: 'http://106.13.115.175:8080/elleshop/userCoupons/allCoupons.do',
            type: 'get',
            data: {
                // setCookie("couponsId",e.info)
                token: getCookie('couponsId')
            },
            success: function (res) {
                console.log(res)
                if (res.code == 0 && res.info.length > 0) {
                    let kong = '';
                    for (let i = 0; i < res.info.length; i++) {
                        kong += `
                        <div class="quan">
                <span class="qian">￥${res.info[i].couponsPrice}</span>
                <div class="you">
                    <b>优惠券</b>
                    <p>有 效 期 : 
                    <span>${res.info[i].beginTime.split('T').join('.').split('.')[0] + ' ' + res.info[i].beginTime.split('T').join('.').split('.')[1]}</span>
                    至
                    <span>${res.info[i].endTime.split('T').join('.').split('.')[0] + ' ' + res.info[i].endTime.split('T').join('.').split('.')[1]}</span>
                    </p>
                 <span class="onely">仅限:<b>13569826779</b>使用</span>
                    </div>
                    <p class="qu">去使用</p>
                </div>
                `
                        $('article').html(kong);
                    }
                }
            }
        })
    }else{
        $('article').html('没有优惠卷');
    }
      
   
   
</script>

</html>